package com.weidong.mybbs.controller;

import com.weidong.mybbs.annotation.Permission;
import com.weidong.mybbs.base.BaseController;
import com.weidong.mybbs.service.SysUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
@Slf4j
public class SysUserController extends BaseController {


    @Autowired
    private SysUserService userService;

    @GetMapping("/getUser/{name}")
    @ResponseBody
    public int checkLoginNameUnique(@PathVariable("name") String name){
        log.info("info");
        log.warn("warn");
        log.error("error");
        log.debug("debug");
        log.info("查询的当前用户是:"+name);
        return userService.checkLoginNameUnique(name);
    }

    @GetMapping("/add")
    @Permission(keys = "UserAdd")
    @ResponseBody
    public String add(){
        return "add success";
    }

    @GetMapping("/edit")
    @ResponseBody
    public String edit(){
        return "edit success";
    }


}
